package com.xbao.controller;

import com.xbao.core.http.CommRequest;
import com.xbao.core.http.CommResult;
import com.xbao.model.req.StuAccountReq;
import com.xbao.model.req.SubjectReq;
import com.xbao.model.vo.StuAccountVo;
import com.xbao.service.StuAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * Created by qingshengzheng on 18/11/2.
 */
@Api(value = "/account", tags = "account")
@RequestMapping(value = "account")
@Controller
@EnableAutoConfiguration
public class AccountController extends BaseController {
    @Resource
    private StuAccountService accountService;

    @ApiOperation(value = "getAccount", notes = "getAccount")
    @RequestMapping(value = "/getAccount",method = RequestMethod.POST)
    @ResponseBody
    public CommResult getAccount(@RequestBody CommRequest<StuAccountReq> balanceTypeCommRequest) {
       StuAccountVo vo= accountService.detailAccountAndSubject(balanceTypeCommRequest.getData());
        return new CommResult<StuAccountVo>(vo);
    }

    @ApiOperation(value = "changeAccount", notes = "getAccount")
    @RequestMapping(value = "/changeAccount",method = RequestMethod.POST)
    @ResponseBody

    public CommResult changeAccount(@RequestBody CommRequest<StuAccountReq> balanceTypeCommRequest) {
       accountService.modifyAccount(balanceTypeCommRequest.getData());
        return result();
    }




}
